package com.clkj.zhonghui.service.system;

import com.clkj.zhonghui.dao.system.RuleMapper;
import com.clkj.zhonghui.pojo.system.Rule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @Author：周佳润
 * @Date：2024/7/17 下午2:47
 */
@Service
public class RuleServiceImpl implements RuleService{

    @Autowired
    private RuleMapper ruleMapper;



    @Override
    public void addRule(Rule rule) {
        if (rule.getRuleId() == null){
            rule.setRuleFlag(0);
            ruleMapper.insertSelective(rule);
        }else {
            ruleMapper.updateByPrimaryKeySelective(rule);
        }
    }

    @Override
    public List<Rule> getRuleList() {
        return ruleMapper.selectAll();
    }
}
